home *** CD-ROM | disk | FTP | other *** search
- /* AFE.CMD version 1.1 */
- /* Created 6 September 1993 by H. M. Weiner */
-
- arg arcfile
-
- /* ---------------------------------------------------------------- */
-
- WORKDIR = 'd:\$temp' /* Variables Definitions: See VARS.TXT */
- WORKDRIVE = 'd:'
- FILESDIRNAME = 'TEMP dir'
- PICKDIR = 'd:\temp'
- UNARCDIR = 'd:\temp'
- ARCDIR = 'd:\dlf'
- UNZIPPER = 'unzip -oj'
- ZIPPER = 'zip -oj9'
- UNLZHER = 'lh2 x'
- LZHER = 'lh2 a'
- SCANRPT = 'd:\dlf\arcscan.rpt'
- SCANNER = 'd:\ref\scan 'workdir'/A/BELL/NOPAUSE/REPORT 'SCANRPT''
- CHIRP = y
-
- /* ---------------------------------------------------------------- */
- call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
- call SysLoadFuncs
- call RxFuncAdd 'VInit', 'VREXX', 'VINIT'
- initcode = VInit()
- if initcode = 'ERROR' then exit
- signal on failure name CLEANUP
- signal on halt name CLEANUP
- signal on syntax name CLEANUP
- select
- when arcfile <> '' then signal arcarg
- otherwise signal go
- end
-
- go:
-
- drop argstart fileext ziplzh action arcname arcfile archname
- NewDirectory = directory(''workdrive'\')
- if Stream(''workdir'\*', 'c', 'query exists') <>'' then do
- call SysFileTree ''workdir'\*', 'files', 'fo'
- do i = 1 to files.0
- call sysfiledelete(files.i)
- end
- end
- call sysrmdir(''workdir'')
- call VDialogPos 50, 35
- list.vstring = 0
- list.0 = 6
- list.1 = View an Archive
- list.2 = Virus Scan Archive
- list.3 = Print Archived File
- list.4 = Unarchive a File
- list.5 = Make or Update LZH
- list.6 = Make or Update ZIP
- call VRadioBox 'ˇˇArchive Front End v1.1 ', list,3
- selection = list.vstring
- if selection = Virus Scan Archive then signal virus
- if selection = View an Archive then do
- action = view
- signal view
- end
- if selection = Print Archived File then do
- action = print
- signal view
- end
- if selection = Unarchive a File then signal unarc
- if selection = Make or Update LZH then signal LZHarc
- if selection = Make or Update ZIP then signal ZIParc
- signal CLEANUP
-
- view:
-
- call VDialogPos 50, 40
- button = VFileBox('Pick an Archive to open...', ''ARCdir'\*.*', 'file')
- if button = 'CANCEL' then signal go
- else
- arcfile = file.vstring
- fileext = right(''arcfile'',3)
- parse upper var fileext fileext
- if fileext = 'ZIP' then signal go_view
- if fileext = 'LZH' then signal go_view
- else signal notarc
-
- go_view:
-
- call openmsg
- call SysMkDir ''workdir''
- 'xcopy 'arcfile' 'workdir''
- Newdirectory = directory(''workdir'')
- call SysFileTree ''workdir'\*.zip', 'zipcount'
- if zipcount.0 = 0 then signal lzhview
- else
- 'del *.zip'
- ''UNZIPPER' 'arcfile''
- call vclosewindow id
- call check4mor
- signal zipdone
- lzhview:
- 'del *.lzh'
- ''UNLZHER' 'arcfile''
- call vclosewindow id
- call check4mor
-
- zipdone:
-
- button = VFileBox('Pick a File to 'action'...', ''workdir'\*.*', 'file')
- if button = 'CANCEL' then do
- signal argchoice
- end
- else
- filename = file.vstring
- NewDirectory = directory(''workdrive'\')
- if action = print then signal printfile
- else
- 'start e 'filename''
- drop action
- signal argchoice
-
- virus:
-
- call VDialogPos 50, 40
- button = VFileBox('Pick an Archive to Scan...', ''ARCdir'\*.*', 'file')
- if button = 'CANCEL' then signal go
- else
- arcfile = file.vstring
- ARCNAME = filespec('n',''arcfile'')
- fileext = right(''arcfile'',3)
- parse upper var fileext fileext
- if fileext = 'ZIP' then signal go_scan
- if fileext = 'LZH' then signal go_scan
- else signal notarc
-
- go_scan:
-
- call openmsg
- call SysMkDir ''workdir''
- 'xcopy 'arcfile' 'workdir''
- NewDirectory = directory(''workdir'')
- call SysFileTree ''workdir'\*.zip', 'zipcount'
- if zipcount.0 = 0 then signal lzhscan
- else
- 'del *.zip'
- ''UNZIPPER' 'arcfile''
- call vclosewindow id
- call check4mor
- signal scanem
- lzhscan:
- 'del *.lzh'
- ''UNLZHER' 'arcfile''
- call vclosewindow id
- call check4mor
-
- scanem:
-
- SCANNER
- if rc = 1 then do
- do 15
- call beep 1000,50
- end
- NewDirectory = directory(''workdrive'\')
- 'start e 'SCANRPT''
- signal cleanup
- end
- else do
- call VDialogPos 50, 35
- if chirp = y then call beep 2000,15
- msg.0 = 1
- msg.1 = ' ˚ No Viruses found in 'ARCNAME' ˚ '
- call VMsgBox ' GOOD NEWS !', msg, 1
- call SysFileDelete(''scanrpt'')
- end
- signal argchoice
-
- unarc:
-
- call VDialogPos 50, 40
- button = VFileBox('Pick a File to UnArchive...', ''ARCdir'\*.*', 'file')
- if button = 'CANCEL' then signal go
- else
- arcfile = file.vstring
- fileext = right(''arcfile'',3)
- parse upper var fileext fileext
- if fileext = 'ZIP' then signal go_un
- if fileext = 'LZH' then signal go_un
- else signal notarc
-
- go_un:
-
- call openmsg
- call SysMkDir ''workdir''
- 'xcopy 'arcfile' 'workdir''
- Newdirectory = directory(''workdir'')
- call SysFileTree ''workdir'\*.zip', 'zipcount'
- if zipcount.0 = 0 then signal lzhun
- else
- 'del *.zip'
- ''UNZIPPER' 'arcfile''
- call vclosewindow id
- call check4mor
- signal unarcact
- lzhun:
- 'del *.lzh'
- ''UNLZHER' 'arcfile''
- call vclosewindow id
- call check4mor
-
- unarcact:
-
- ARCNAME = filespec('n',''arcfile'')
- call VDialogPos 50, 35
- list.0 = 2
- list.1 = All Files
- list.2 = Select Files
- call VRadioBox 'Extract 'ARCNAME'', list,3
- selection = list.vstring
- if selection = All Files then do
- 'xcopy * 'UNARCdir''
- signal go
- end
- if selection = Select Files then signal pickmore
- else
- signal go
-
- pickmore:
-
- call VDialogPos 50,40
- button = VFileBox('File to Extract, Cancel After All Files Have Been Selected...', ''workdir'\*.*', 'file')
- if button = 'CANCEL' then signal go
- else
- filename = file.vstring
- 'xcopy 'filename' 'UNARCdir''
- signal pickmore
-
- arcarg:
-
- call openmsg
- fileext = right(''arcfile'',3)
- parse upper var fileext fileext
- if fileext = 'ZIP' then do
- ziplzh = pickzip
- signal go_arg
- end
- if fileext = 'LZH' then do
- ziplzh = picklzh
- signal go_arg
- end
- else signal notarc
-
- go_arg:
-
- call SysMkDir ''workdir''
- 'xcopy 'arcfile' 'workdir''
- Newdirectory = directory(''workdir'')
- if ziplzh = picklzh then signal lzhun2
- else
- 'del *.zip'
- ''UNZIPPER' 'arcfile''
- call vclosewindow id
- call check4mor
- signal argchoice
- lzhun2:
- 'del *.lzh'
- ''UNLZHER' 'arcfile''
- call vclosewindow id
- call check4mor
-
- argchoice:
-
- argstart = on
- call SysFileTree ''arcfile'',date,t
- datetime = date.1
- filedate = left(datetime,8)
- ARCNAME = filespec('n',''arcfile'')
- fileext = right(''arcfile'',3)
- parse upper var fileext fileext
- if fileext = 'ZIP' then ziplzh = pickzip
- if fileext = 'LZH' then ziplzh = picklzh
- NewDirectory = directory(''workdir'')
- call VDialogPos 50, 35
- list.vstring = 0
- list.0 = 5
- list.1 = View a File
- list.2 = Print a File
- list.3 = Virus Scan Archive
- list.4 = Extract a File
- list.5 = Add to this Archive
- call VRadioBox ''Arcname'' ''filedate'', list,3
- selection = list.vstring
- if selection = Virus Scan Archive then signal scanem
- if selection = View a File then do
- action = view
- signal zipdone
- end
- if selection = Print a File then do
- action = print
- signal zipdone
- end
- if selection = Extract a File then signal unarcact
- if selection = Add to this Archive then signal arcex
- else
- signal go
-
- check4mor:
-
- Call SysFileTree ''workdir'\*.zip', 'count'
- if count.0 > 0 then signal morezip
- else
-
- check4morL:
-
- Call SysFileTree ''workdir'\*.lzh', 'count'
- if count.0 > 0 then signal morelzh
- else return
-
- morezip:
-
- call VDialogPos 50, 35
- if chirp = y then call beep 2000,15
- msg.0 = 2
- msg.1 = ' ZIPfiles exist within your archive !'
- msg.2 = ' Press Okay to continue...'
- call VMsgBox ' ! ATTENTION !', msg, 1
- call VDialogPos 50,40
- button = VFileBox('ZIP to UnArchive, Cancel After All Files Have Been Selected...', ''workdir'\*.zip', 'file')
- if button = 'CANCEL' then signal check4morL
- else
- filename = file.vstring
- ''UNZIPPER' 'filename''
- 'del 'filename''
- signal check4mor
-
- morelzh:
-
- call VDialogPos 50, 35
- if chirp = y then call beep 2000,15
- msg.0 = 2
- msg.1 = ' LZHfiles exist within your archive !'
- msg.2 = ' Press okay to continue...'
- call VMsgBox '', msg, 1
- call VDialogPos 50,40
- button = VFileBox('LZH to UnArchive, Cancel After All Files Have Been Selected...', ''workdir'\*.lzh', 'file')
- if button = 'CANCEL' then return
- else
- filename = file.vstring
- ''UNLZHER' 'filename''
- 'del 'filename''
- signal check4mor
-
- LZHarc:
-
- ZIPLHZ = pickLZH
- signal DOarc
-
- ZIParc:
-
- ZIPLZH = pickZIP
-
- DOarc:
-
- list.0 = 2
- list.1 = Create New Archive
- list.2 = Update Existing
- call VRadioBox 'New or Update', list,3
- selection = list.vstring
- if selection = Update Existing then signal arcex
- if selection = Create New Archive then signal makenew
- else do
- signal go
- end
-
- makenew:
-
- prompt.0 = 1
- prompt.1 = 'ˇˇˇ[[without the extension]]'
- prompt.vstring = ''
- button = VInputBox('Enter the Archive Name :', prompt, 10, 3)
- ARCHname = prompt.vstring
- if button = cancel then signal go
- arcfileext = right(ziplzh,3)
- if Stream(''arcdir'\'archname'.'arcfileext'','C', 'Query Exists') <>'' then do
- if chirp = y then call beep 2000,15
- parse upper var archname archname2
- msg.0 = 3
- msg.1 = ' 'archname2'.'arcfileext' already exists in 'arcdir' !'
- msg.2 = ' Press OK to Overwrite...'
- msg.3 = ' Press Cancel to Input a New Name...'
- overwritebutton = VMsgBox('WARNING: " 'arcdir'\'archname2'.'arcfileext' " will be destroyed !',msg, 3)
- if overwritebutton = cancel then signal makenew
- call SysFileDelete (''arcdir'\'archname'.'arcfileext'')
- end
- else
- if archname = '' then do
- if chirp = y then call beep 2000,15
- msg.0 = 3
- msg.1 = ' You did not input an Archive Name !'
- msg.2 = ' Press Okay to try again...'
- msg.3 = ' Press Cancel to Abort...'
- namebutton = VMsgBox(' ERROR ! ERROR ! ERROR !', msg, 3)
- if namebutton = cancel then signal go
- if namebutton = ok then signal makenew
- signal go
- end
- else
- list.0 = 2
- list.1 = All Files in FILESdirname
- list.2 = Selected Files
- call VRadioBox 'Which Files ?', list,3
- selection = list.vstring
- if selection = Selected Files then signal pickmorz
- if selection = All Files in FILESdirname then signal allnew
- else signal go
-
- allnew:
-
- if Stream(''pickdir'\*','C', 'Query Exists') = '' then signal nofiles
- call zipupmsg
- NewDirectory = directory(''ARCdir'')
- if ziplzh = pickzip then do
- ''ZIPPER' 'ARCHname'.ZIP 'PICKdir'\*'
- call vclosewindow id
- signal go
- end
- else do
- ''LZHER' 'ARCHname'.LZH 'PICKdir'\*'
- call vclosewindow id
- signal go
- end
- else
- signal go
- end
-
- pickmorz:
-
- call VDialogPos 50,40
- button = VFileBox('File to Include, Cancel After All Files Have Been Selected...', ''PICKdir'\*.*', 'file')
- if button = 'CANCEL' then signal ARCup
- else
- filename = file.vstring
- call SysMkDir ''workdir''
- 'xcopy 'filename' 'workdir''
- signal pickmorz
-
- ARCup:
-
- if Stream(''workdir'\*','C', 'Query Exists') = '' then signal go
- call zipupmsg
- NewDirectory = directory(''ARCdir'')
- if ZIPLZH = pickzip then do
- ''ZIPPER' 'ARCHname'.ZIP 'workdir'\*'
- call vclosewindow id
- signal go
- end
- else do
- ''LZHER' 'ARCHname'.LZH 'workdir'\*'
- call vclosewindow id
- signal go
- end
-
- arcex:
-
- if argstart = on then signal argadd
- else
- call VDialogPos 50,40
- button = VFileBox(' Archive file to Update...', ''ARCdir'\*.*', 'file')
- if button = 'CANCEL' then do
- signal go
- end
- else
- arcfile = file.vstring
- if ZIPLZH = pickzip then do
- fileext = right(''arcfile'',3)
- parse upper var fileext fileext
- if fileext <> 'ZIP' then signal notziplzh
- else signal argadd
- end
- else do
- fileext = right(''arcfile'',3)
- parse upper var fileext fileext
- if fileext <> 'LZH' then signal notziplzh
- else signal argadd
- end
- else
-
- argadd:
-
- call VDialogPos 50, 35
- list.0 = 2
- list.1 = All Files in FILESdirname
- list.2 = Selected Files
- call VRadioBox 'Which Files ?', list,3
- selection = list.vstring
- if selection = Selected Files then signal pickmorez
- if selection = All Files in Filesdirname then signal arcupall
- else signal go
- end
-
- arcupall:
-
- if Stream(''pickdir'\*','C', 'Query Exists') = '' then signal nofiles
- call zipupexmsg
- if ziplzh = pickzip then do
- ''ZIPPER' 'arcfile' 'PICKdir'\*'
- call vclosewindow id
- signal go
- end
- else
- ''LZHER' 'arcfile' 'PICKdir'\*'
- call vclosewindow id
- signal go
- end
-
- pickmorez:
-
- call VDialogPos 50,40
- button = VFileBox('File to Include, Cancel After All Files Have Been Selected...', ''PICKdir'\*.*', 'file')
- if button = 'CANCEL' then signal ARCupex
- else
- filename = file.vstring
- call SysMkDir ''workdir''
- 'xcopy 'filename' 'workdir''
- signal pickmorez
-
- ARCupex:
-
- if Stream(''workdir'\*','C', 'Query Exists') = '' then signal go
- else
- call zipupexmsg
- NewDirectory = directory(''ARCdir'')
- if ZIPLZH = pickzip then do
- ''ZIPPER' 'arcfile' 'workdir'\*'
- call vclosewindow id
- signal go
- end
- else do
- ''LZHER' 'arcfile' 'workdir'\*'
- call vclosewindow id
- signal go
- end
-
- notziplzh:
-
- ARCNAME = filespec('n',''arcfile'')
- fileext = right(ziplzh,3)
- parse upper var fileext fileext
- call VDialogPos 50, 35
- if chirp = y then call beep 2000,15
- msg.0 = 2
- msg.1 = ' 'ARCname' is not a 'fileext' archive !'
- msg.2 = ' Press okay to continue...'
- call VMsgBox ' ERROR ! ERROR ! ERROR !', msg, 1
- signal go
-
- notarc:
-
- ARCNAME = filespec('n',''arcfile'')
- call VDialogPos 50, 35
- if chirp = y then call beep 2000,15
- msg.0 = 2
- msg.1 = ' 'ARCname' is not an Archive File !'
- msg.2 = ' Press okay to continue...'
- call VMsgBox ' ERROR ! ERROR ! ERROR !', msg, 1
- signal go
-
- nofiles:
-
- call VDialogPos 50, 35
- if chirp = y then call beep 2000,15
- msg.0 = 2
- msg.1 = ' There are no files in 'filesdirname' !'
- msg.2 = ' Press okay to continue...'
- call VMsgBox ' ERROR ! ERROR ! ERROR !', msg, 1
- signal go
-
- printfile:
-
- call VDialogPos 50, 35
- if chirp = y then call beep 2000,15
- msg.1 = ' Make sure printer is Powered Up and On Line !'
- msg.2 = ' Press OK to continue...'
- msg.3 = ' Press Cancel to abort...'
- button = VMsgBox('ˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇAttention!', msg, 3)
- if button = OK then do
- print '"'filename'"'
- drop action
- signal argchoice
- end
- else
- drop action
- signal argchoice
-
- openmsg:
-
- win.left = 30
- win.right = 70
- win.top = 1
- win.bottom = 1
- id = VOpenWindow('Opening " 'arcfile' "', 'black', win)
- return
-
- zipupmsg:
-
- parse upper var archname archname
- win.left = 35
- win.right = 65
- win.top = 1
- win.bottom = 1
- id = VOpenWindow('Creating " 'archname'.'arcfileext' "', 'black', win)
- return
-
- zipupexmsg:
-
- win.left = 30
- win.right = 70
- win.top = 1
- win.bottom = 1
- id = VOpenWindow('Updating " 'arcfile' "', 'black', win)
- return
- CLEANUP:
-
- win.left = 34
- win.right = 66
- win.top = 1
- win.bottom = 1
- id = VOpenWindow('Thanks for using AFE... hmw', 'black', win)
- NewDirectory = directory(''workdrive'\')
- if Stream(''workdir'\*', 'c', 'query exists') <>'' then do
- call SysFileTree ''workdir'\*', 'files', 'fo'
- do i = 1 to files.0
- call sysfiledelete(files.i)
- end
- end
- call sysrmdir(''workdir'')
- call vclosewindow id
- call VExit
- exit